<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateChecksTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('checks', function (Blueprint $table) {
//            $table->comment('学年考核');
            $table->increments('id');
            $table->integer('data_version_id')->index('data_version_id_index');
            $table->string('data_version_name', 255)->default('');
            $table->string('name', 255)->default('')->comment('岗位名称');
            $table->date('check_start')->nullable()->comment('考核开始时间');
            $table->date('check_end')->nullable()->comment('考核结束时间');
            $table->integer('scale_id')->comment('量表id');
            $table->text('comment')->comment('说明');
            $table->json('files')->nullable()->comment('材料');
            $table->json('leader')->nullable()->comment('考评组长');
            $table->json('members')->nullable()->comment('考评成员');
            $table->integer('check_sum')->default(0)->comment('考评组数量（组长+成员）');
            $table->text('teachers')->comment('参与老师');
            $table->json('materials_date')->nullable()->comment('调取资料时间');
            $table->string('materials_text', 255)->comment('调取资料时间名称');
            $table->boolean('status')->default(true)->comment('0-待提交 1-已提交');
            $table->integer('author_id')->default(0)->index('author_id_index')->comment('创建人id');
            $table->string('author_name', 25)->default('')->comment('创建人姓名');
            $table->boolean('is_copy')->default(false)->comment(' 0- 1-');
            $table->timestamp('created_at')->nullable()->useCurrent();
            $table->timestamp('updated_at')->useCurrentOnUpdate()->nullable()->useCurrent();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('checks');
    }
};
